CV_CONVERT_COEFF
Overview
Converts between different flow coefficient scales (Kv, Cv, Av).
Excel Usage
=CV_CONVERT_COEFF(coeff, old_scale, new_scale)
coeff(float, required): Flow coefficient value to convert.old_scale(str, required): Original scale (e.g., Kv, Cv, Av).new_scale(str, required): Target scale (e.g., Kv, Cv, Av).
Returns (float): Converted flow coefficient.
Examples
Example 1: Kv to Cv
Inputs:
| coeff | old_scale | new_scale |
|---|---|---|
| 10 | Kv | Cv |
Excel formula:
=CV_CONVERT_COEFF(10, "Kv", "Cv")
Expected output:
11.56
Example 2: Cv to Kv
Inputs:
| coeff | old_scale | new_scale |
|---|---|---|
| 11.56 | Cv | Kv |
Excel formula:
=CV_CONVERT_COEFF(11.56, "Cv", "Kv")
Expected output:
10
Example 3: Kv to Av
Inputs:
| coeff | old_scale | new_scale |
|---|---|---|
| 10 | Kv | Av |
Excel formula:
=CV_CONVERT_COEFF(10, "Kv", "Av")
Expected output:
0.00027765
Example 4: Same scale
Inputs:
| coeff | old_scale | new_scale |
|---|---|---|
| 50 | Cv | Cv |
Excel formula:
=CV_CONVERT_COEFF(50, "Cv", "Cv")
Expected output:
50
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.control_valve import convert_flow_coefficient
def cv_convert_coeff(coeff, old_scale, new_scale):
"""
Converts between different flow coefficient scales (Kv, Cv, Av).
See: https://fluids.readthedocs.io/fluids.control_valve.html#fluids.control_valve.convert_flow_coefficient
This example function is provided as-is without any representation of accuracy.
Args:
coeff (float): Flow coefficient value to convert.
old_scale (str): Original scale (e.g., Kv, Cv, Av). Valid options: Kv (metric), Cv (US), Av (SI).
new_scale (str): Target scale (e.g., Kv, Cv, Av). Valid options: Kv (metric), Cv (US), Av (SI).
Returns:
float: Converted flow coefficient.
"""
if coeff < 0:
return "Error: Flow coefficient cannot be negative."
try:
return float(convert_flow_coefficient(coeff, old_scale, new_scale))
except Exception as e:
return f"Error: {str(e)}"